import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { sveltePreprocess } from 'svelte-preprocess/dist/autoProcess'
import { less as svelteLess } from 'svelte-preprocess-less'

// https://vitejs.dev/config/
export default defineConfig({
  base: './',
  plugins: [svelte(
    {
      preprocess: sveltePreprocess({
        style: svelteLess()
      })
    }
  )],
  server: {
    host: '0.0.0.0',
    port: 3000,
    https: false,
    proxy: {
      '/api': {
        target: '',
        rewrite(path) {
          return path.replace('/api', '')
        },
      }
    }
  },
  build: {
    outDir: 'dist',
    assetsDir: 'assets',
    sourcemap: false
  }
})
